﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Smartec.Accounts.Camel.AMS.Model.Managers
{
    internal static class UtilitiesManager
    {
        #region FormatEstimatedLifeTime
        public static string FormatEstimatedLifeTime(int? EstimatedLifeTime)
        {
            string years = "";
            string months = "";
            if (EstimatedLifeTime.HasValue)
            {
                int estimationLifeTime = EstimatedLifeTime.Value;

                double yearsValue = Math.Floor((double)(estimationLifeTime / 12));
                int monthsValue = (estimationLifeTime % 12);

                if (yearsValue > 0)
                    years = string.Format("Years: {0}", yearsValue);

                if (monthsValue > 0)
                    months = string.Format("Months: {0}", monthsValue);

                return string.Format("{0}{1}{2}", years, yearsValue > 0 && monthsValue > 0 ? ", " : "", months);
            }

            return "";
        }
        #endregion //FormatEstimatedLifeTime
    }
}
